﻿//
using PerceptiveMCAPI;
//
namespace PerceptiveMCAPI_Test
{
   public partial class get_SecurityParms : System.Web.UI.UserControl
   {
      public ApiMethod method { get; set; }

      public string username
      {
         get { return tbUsername.Text.Trim(); }
         private set { tbUsername.Text = value; }
      }
      public string password
      {
         get { return tbPassword.Text.Trim(); }
         private set { tbPassword.Text = value; }
      }
      public string apikeyToExpire
      {
         get { return tbExpireApikey.Text.Trim(); }
         private set { tbExpireApikey.Text = value; }
      }
      public bool ShowExpired
      {
         get { return cbExpired.Checked; }
         private set { cbExpired.Checked = value; }
      }

      public void Setup()
      {
         this.Visible = true;
         lblSection.Text = method.section;
         lblMethod.Text = method.name;
         tbUsername.Focus();
         //
         cbExpired.Visible = false;
         litExpire.Visible = false;
         tbExpireApikey.Visible = false;
         //
         switch ( method.name )
         {
            case "apikeys":
               cbExpired.Visible = true;
               break;
            case "apikeyAdd":
               break;
            case "apikeyExpire":
               litExpire.Visible = true;
               tbExpireApikey.Visible = true;
               cbExpired.Checked = MCAPISettings.default_apikeys_expired;
               break;
         }
      }
   }
}